﻿@using FwProject.Roles.Dto
@model RoleInput
<style>
    .layui-table tr th, .layui-table tr td {
        text-align: center;
        padding: 9px 15px !important
    }

    .layui-form {
        padding: 15px;
    }

    .search-suggest .content {
        max-height: 300px;
        overflow-y: scroll;
    }

    .search-suggest {
        z-index: 19891020;
    }

    .hidden {
        display: none;
    }
</style>
<form id="form0" class="layui-form layui-form-pane" action="@Url.Action("CreateRole")" method="post" novalidate="novalidate" data-ajax="true" data-ajax-begin="LockAjaxCallbackBack" data-ajax-success="ReloadAjaxCallbackgoback" data-ajax-failure="FailureAjaxCallback" data-ajax-method="Post" role="form" lay-filter="form1" style="margin-bottom: 80px;">
    <div class="layui-form-item">
        @Html.LabelFor(o => o.DisplayName, new { @class = "layui-form-label" })
        <div class="layui-input-block">
            @Html.TextBoxFor(o => o.DisplayName, new { @class = "layui-input" })
            @Html.ValidationMessageFor(o => o.DisplayName)
        </div>
    </div>
    <div class="layui-form-item">
        @Html.LabelFor(o => o.NormalizedName, new { @class = "layui-form-label" })
        <div class="layui-input-block">
            @Html.TextBoxFor(o => o.NormalizedName, new { @class = "layui-input" })
            @Html.ValidationMessageFor(o => o.NormalizedName)
        </div>
    </div>
    <div class="layui-form-item">
        @Html.LabelFor(o => o.Description, new { @class = "layui-form-label" })
        <div class="col-md-6">
            @Html.TextAreaFor(o => o.Description, new { @class = "layui-textarea" })
            @Html.ValidationMessageFor(o => o.Description)
        </div>
    </div>
</form>
<div class="layui-layer-btn layui-layer-btn-" style="padding:8px 12px;z-index:1000;position: fixed;bottom:0;left: 1px;width: 98%;height: 50px; background:rgba(230,230,230,0.8)">
    <a id="save" class="layui-layer-btn0" lay-submit="" lay-filter="saveprops">保存</a>
</div>
@section scripts{
    <script src="~/js/main.js"></script>
    <script type="text/javascript">
        var form, layer, layedit, upload;
        layui.use(['form', 'layedit', 'layer', 'upload'], function () {
            layedit = layui.layedit;
            form = layui.form;
            layer = layui.layer;
            upload = layui.upload;
            //自定义验证规则
            form.verify({
                required: function (value) {
                    if (value == "") {
                        return '必填项不能为空';
                    }
                }
            });
        })

        function ReloadAjaxCallbackgoback(data, successInfo) {
            if (data.success) {
                parent.layer.msg('保存成功！')
                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                parent.layer.close(index); //再执行关闭当前iframe页面
            } else {
                layer.msg('保存失败：' + successInfo);
            }
        }


        $('#save').on('click', function () {
            $('#form0').submit();
        });

    </script>
}

